/*
 * @Author: fishroom
 * @Date: 2023-01-04 10:41:58
 * @LastEditTime: 2023-01-06 15:02:12
 * @FilePath: \koa\app\controller\updalod\fileController.ts
 */
import { Context } from "koa";
import response from "../../util/response";
class FileController {
  async image(ctx: Context) {
    const file = ctx.request.files?.file;
    let path = (file instanceof Array ? "" : file?.filepath)?.split("static\\")[1];

    response.CxtSuccess(
      ctx,
      {
        url: "http://" + ctx.request.header.host +'/' + path,
      },
      "成功",
      0
    );
  }
}
export default new FileController();
